<template>
  <el-dialog
    :title=" '核酸结果填报'"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
             label-width="140px">
      <el-form-item label="核酸检测结果：" prop="hesuan">
        <el-select
          style="margin-top: 20px"
          v-model="dataForm.hesuan"
          size="big"
          placeholder="请选择"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </el-form-item>





    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data() {
      return {
        options: [
          {
            value: "阳性",
            label: "阳性",
          }, {
            value: "阴性",
            label: "阴性",
          }],
        visible: false,
        dataForm: {
          id: '',
          userId: '',
          tempTime: '',
          hesuan: '',
        },

      }
    },
    methods: {
      init(id) {
        this.visible = true
        this.dataForm = id
      },
      // 表单提交
      async  dataFormSubmit() {
        let result =  await this.$API.room.updateHesuan({
          'id': this.dataForm.id,
          'hesuan': this.dataForm.hesuan,
          'userId': this.dataForm.userId,
          'tempTime': this.dataForm.tempTime,
        });
        if (result.code == 20000) {
          this.$message({
            message: '提报成功',
            type: 'success',
            duration: 900,
            onClose: () => {
              this.visible = false
              this.$emit('refreshDataList')
            }
          })
        }
      }
    }
  }
</script>
